home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2311 < prev    next >
Encoding:
Text File  |  1996-08-06  |  836 b   |  49 lines

  1. Path: ornews.intel.com!news
  2. From: thurman_b_miller@ccm2.hf.intel.com (Thurman Miller)
  3. Newsgroups: comp.lang.c++
  4. Subject: When to use "->" vs "." when calling Member functions
  5. Date: Wed, 17 Jan 1996 00:00:59 GMT
  6. Organization: Intel Corporation
  7. Message-ID: <4dhea1$6v8@ornews.intel.com>
  8. NNTP-Posting-Host: thurman-pc.ssd.intel.com
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. I'm confused, so please no harsh remarks :)
  12.  
  13. If I've got:
  14.  
  15. class Cfoo
  16. {
  17.     something * getptr();
  18.     somethingelse* m_other;
  19. }
  20.  
  21. something * foo::getptr()
  22. {
  23.     return m_other;
  24. }
  25.  
  26.  
  27. Now...if I'm in another class....
  28.  
  29.     Cfoo foo;
  30.     somethingelse* = foo.getptr();
  31.  
  32. why doesn't the following work?
  33.  
  34.     somethingelse* = foo->getptr();
  35.  
  36. I get compile error about no "->" overloaded operator....
  37.  
  38. Can someone point out the obvious when I use one notation over
  39. another?
  40.  
  41. TIA
  42.  
  43. Thurman
  44.  
  45.  
  46.  
  47.  
  48.  
  49.